var tokenParam = localStorage.getItem('tokenParam');
if(tokenParam == null){
    window.location.href = 'index.html'
}
function getData(url,data,fun){
    var tokenParam = localStorage.getItem('tokenParam');
    $.get(url + '?' + tokenParam,data,function(str){
        var res = eval('(' + str + ')');
        if(res.code >= 1000){
            window.location.href = 'index.html'
        }
        fun(res)
    });
}
function postData(url,data,fun){
    var tokenParam = localStorage.getItem('tokenParam');
    $.post(url + '?' + tokenParam,data,function(str){
        // alert(str)
        var res = eval('(' + str + ')');
        if(res.code >= 1000){
            window.location.href = 'index.html'
        }
        fun(res)
    });
}